
<?php 
$cookie['userslog'] = unserialize(stripslashes($_COOKIE['userslog']));
//print_r($cookie);exit;
function checkUserIsLogin($userType=""){
	global $cookie;
       if(!isset($_COOKIE['userslog'])){
			$url =  explode("/",$_SERVER["REQUEST_URI"]);
			setcookie("nextURL", array_pop($url), time()+60*60);
			//$_COOKIE['nextURL'] = array_pop($url);
       		header("location:".BASEPATH."login.php");
            exit;
       }
       
       if($userType == "admin" && $cookie['userslog']['is_admin'] == 0){
               header("location:".BASEPATH."login.php");
               exit;
       }
}
?>
